<?php

namespace App\Traits;

use Illuminate\Http\RedirectResponse;

trait WebResponse
{
    use ApiResponse;
    /**
     * @var int
     */
    protected $success = true;

    /**
     * 页面跳转
     * @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function permissions()
    {
        return redirect('prompt')->with(['message'=>'错误操作，您没有当前连接的访问权限~','jumpUrl' =>'/', 'jumpTime'=>3]);
    }

    /**
     * 页面跳转
     * @param string $url
     * @param string $message
     * @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function errorJump(string $url, string $message = '操作失败, 参数错误')
    {
        return redirect('prompt')->with(['message' => $message, 'jumpUrl' => $url, 'jumpTime'=>3]);
    }
}
